<template>
	<view class="my-container">
		<login-info></login-info>
		<!-- <view class="my-info">
			<u-avatar :src="userInfo.avatarUrl" size="80"></u-avatar>
			<text class="my-info-name" v-if="flag">{{userInfo.nickName}}</text>
			<text class="my-info-name" v-else @click="loginFn">马上登录</text>
		</view> -->
		<u-cell-group>
			<u-cell title="我的收藏" size="large" @click="toCollect" :isLink="true"></u-cell>
			<u-cell title="问题反馈" size="large" :isLink="true" url="/pages/feedback/feedback"></u-cell>
			<u-cell title="关于我们" size="large" :isLink="true" url="/pages/about/about"></u-cell>
			<u-cell title="联系我们" size="large" :isLink="true" url="/pages/feedback/feedback"></u-cell>
		</u-cell-group>
		<u-button text="退出登录" @click="exitFn"></u-button>
	</view>
</template>

<script>
	import LoginInfo from "@/components/logininfo.vue"
	import {
		getUserInfo
	} from "@/utils/utils.js";
	export default {
		components: {
			LoginInfo
		},
		data() {
			return {};
		},
		methods: {
			// 跳转收藏
			toCollect() {
				// 需要判断是否登录
				uni.navigateTo({
					url: "/pages/collect/collect"
				})
			},
			// 退出登录
			exitFn() {
				uni.showModal({
					title: '确定退出登录吗?',
					success: function(res) {
						if (res.confirm) {
							uni.clearStorageSync("info");
							uni.reLaunch({
								url: '/pages/my/my'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.my-info {
		background-color: #007aff;

		@include flex;
		align-items: center;
		padding: 80rpx 40rpx;

		.my-info-name {
			color: #fff;
			font-size: 40rpx;
			margin-left: 20rpx;
		}

	}

	::v-deep {
		button {
			margin-top: 40rpx;
		}
	}
</style>
